

CC = gcc
CFLAGS = -Wall -g -pedantic -march=native -O2 -lm

targets = sim

sim_headers = pcb.h \
			  sched0.h \
              sched1.h \
	      sched2.h \
		  common_sched.h \
	      tracereader.h \
	      io_queue.h \
	      stats.h \
		  sim.h \
		  doubleL.h \
		  red_black_tree.h \
		  stack.h \
		  misc.h 


sim_objs = sim.o \
           pcb.o\
		   sched0.o \
           sched1.o \
	   sched2.o \
	   common_sched.o \
	   tracereader.o \
	   io_queue.o \
	   stats.o \
	   doubleL.o \
	   stack.o \
	   red_black_tree.o \
	   misc.o

.PHONY: all
.DEFAULT: all
all: $(targets)

sim: $(sim_objs) $(sim_headers)
	$(CC) $(CFLAGS) $^ -o $@

	
%.o: %.c 
	$(CC) $(CFLAGS) -c $^ -o $@

.PHONY: clean
clean:
	$(RM) $(targets) *.o 

